	function Change(){
			$.post("http://localhost:8080/Prodavalnik/ProfileServlet", {"name":name},
			function(data){
				if(data == "error"){
					alert('You\'re not logged in!');
					GettoHomePage();
				}
				var values=data.split(',');	
				$("#email").replaceWith("<input class=\"form-control\" type=\"text\" placeholder=\"email\" value=\""+values[0]+"\">");
			}
		); 
	}
	
	function GettoHomePage(){
						window.location.replace("copyOfpage1.html");
	}
	

	function Logout(){
		$.post("http://localhost:8080/Prodavalnik/LogoutServlet",
				function(data){
					GettoHomePage();
		}/* end of function(data) */
			); /* End of post */	
	}/*End of Logout() */
	
	function Like(prid){
		$.post("http://localhost:8080/Prodavalnik/LikeServlet",{'prid':prid},
		function(data){
			if(data=="false"){
				alert("You're not logged in");
				GettoHomePage();
			}
			else{
				alert("Thank you for liking! ")
			}
			}/*end of function(data)*/
		)/*End of post*/	
	}/*End of Like()*/

	function showProduct(prid){
		$.post("http://localhost:8080/Prodavalnik/displayAdByIdServlet",{'Productid':prid},
		function(data){ 
		var values = data.split(';'); 
		var nameOfpicture = values[3].split('img\\');
		var name = nameOfpicture[1].split(']');
		$("#col-md-6").empty().html("<div class=\"col-md-6\" id=\"col-md-6\">"+
		   "<div><div><div>"+
		   "<h1 align=\"center\">"+values[0]+"</h1><p></p><p></p>"+
		"</div><div>" +
		"<div><img src = \"VisualizePictureWithName?name="+name[0]+"\" width=\"300\" height=\"300\" align=\"center\" />"+
		"</div><div><p></p><p></p><h4 align=\"center\">Description:</h4> <p align=\"center\">"+values[1]+"</p><p><h4 align=\"center\"> Price: </h4> <p align=\"center\">"+ values[2]+ " BGN</p></div>"+
		"<div id= \"footer\" class=\"modal-footer\">"+
		"<p><p align=\"center\"><button onclick=\"Like("+prid+")\"> Like </button></p>"+
					"<p align=\"center\" <button onclick=\"GettoHomePage()\" >Back</button></p></p>"+
			    "</div>"+
		"</div></div></div></div>");
		 		
		})}